import Vue from 'vue'
import VueRouter from 'vue-router'
// import { nextTick } from 'vue/types/umd'
import recommend from '../views/recommend.vue'
// import singer from '' 
Vue.use(VueRouter)

const routes = [

   {
    path:"/",
    redirect:"/recommend"
   },
   {//个人中心
     path:"/userInfo",
     name:"userInfo",
     component:()=>import("../views/userInfo.vue"),
     beforeEnter:(to,from,next)=>{
       let login = window.localStorage.getItem("token");
        if(!login){
          next("/login");
          return;
        }else{
          next();
        }
     }
   },
   {//歌单
      path:"/listvue",
      name:"listvue",
      component:()=>import("../components/base/listvue.vue"),
    },
    {//历史歌单
      path:"/hotisy",
      name:"hotisy",
      component:()=>import("../components/base/hotisy.vue"),
    },
   {
    //登入
     path:"/login",
     name:"login",
     component:()=>import("../components/base/login.vue")
   },
   {//首页
     path:"/recommend",
     name:"recommend",
     component:recommend
   },
   {//推荐歌单更多
    path:"/recommend/songmoress",
    name:"songmoress",
    component:()=>import("../components/reomss/songmoress.vue")
   },
   //播客
    {
      path:"/podcast",
      name:"podcast",
      component:()=>import("../views/podcast.vue")
    },
    //关注
    {
      path:"/attent",
      name:"attent",
      component:()=>import("../views/attent.vue")
    },
    //mv
    {
      path:"/mvlist",
      name:"mvlist",
      component:()=>import("../views/mvlist.vue")
    },
   {
    path:"/Search",
    name:"Search",
    //搜索
    component:()=>import("../components/Search/Search.vue")
   },
   {//歌手
    path:"/singer",
    name:"singer",
    component:()=>import("../views/singer.vue")
   },
    {//歌手详情
      path:"/singer/songerss",
      name:"singer",
      component:()=>import("../components/songerss/songerss.vue")
     },
   {
     //排行榜
    path:"/rank",
    name:"rank",
  
    component:()=>import("../views/rank.vue")
   },
    {
      //排行榜歌单列表
      path:"/rank/ranklist",
      name:"ranklist",
      component:()=>import("../components/rank/ranklist.vue")
    },
    {
      //评论
      path:"/pinglun",
      name:"pinglun",
      component:()=>import("../components/ping/pinglun.vue")
    },
    // {
    //   path:"/player",
    //   name:"player",
    //   component:()=>import("../components/base/player.vue")
    // },
    {
      path:"/podcast",
      name:"podcast",
      component:()=>import("../views/podcast.vue")
    }
  // {
  //   path: '/',
  //   name: 'Home',
  //   component: Home
  // },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass:"tcon"
  // link
})

export default router
